import { h } from 'vue';
import { RouterLink } from 'vue-router';
import routers from '@/router/index.js';
import { NIcon } from 'naive-ui';

// 引入图标
import { MdHome } from '@vicons/ionicons4';
import { PersonCircleOutline as UserIcon, Pencil as EditIcon, LogOutOutline as LogoutIcon } from '@vicons/ionicons5';
import { Report, Debug, Application } from '@vicons/carbon';

const renderIcon = (icon) => h(NIcon, null, { default: () => h(icon) })
const renderRouterLink = (Routername, title) => h(RouterLink, {to: {name: Routername}}, { default: () => title })

const Setting = {
    // 主题配色参数
    themeOverrides: {
        "common": {
            "primaryColor": "#6998AB",
            "primaryColorHover": "#6998AB"
        },
        "Dropdown": {
            "optionTextColor": "rgba(188, 188, 188, 1)",
            "optionTextColorHover": "rgba(188, 188, 188, 1)"
        }
    },
    // 左侧导航菜单栏配置
    menuOptions: [
        {
            label: ()=> renderRouterLink('Index', '首页'),
            key: 'index',
            icon: ()=> renderIcon(MdHome)
        },
        {
            label: ()=> renderRouterLink('Record', '记录管理'),
            key: 'recordAdmin',
            icon: ()=> renderIcon(Report)
        },
        {
            label: ()=> renderRouterLink('Problem', '缺陷管理'),
            key: 'problemAdmin',
            icon: ()=> renderIcon(Debug)
        },
        {
            label: ()=> renderRouterLink('UserAdmin','用户管理'),
            key: 'userAdmin',
            icon: ()=> renderIcon(Application)
        }
    ],
    // 顶部用户信息栏
    options: [
        {
          label: '修改密码',
          key: 'modifyPwd',
          icon: ()=> renderIcon(EditIcon)
        },
        {
            // 退出登录，跳转至登录页面
          label: ()=> renderRouterLink('Login', '退出登录'),
          key: 'logout',
          icon: ()=> renderIcon(LogoutIcon)
        }
      ]
}

export default Setting